﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.Windows.Forms;
using Security;

namespace VehicleMaintenance.Comm
{
	internal class RegisterInfo
	{
		//[DllImport("Security2.dll")]
		//static extern string GetLic();

		internal static bool IsRegistered()
		{
			try
			{
				string regFile = Path.Combine(Application.StartupPath, "Register.lic");
				if (File.Exists(regFile))
				{
					using (TextReader reader = File.OpenText(regFile))
					{
						string fileInfo = reader.ReadToEnd().Trim();
						string encryptInfo = EncryptClass.GetCode();
                        //string encryptInfo = GetLic();
						if (fileInfo == encryptInfo)
						{
							return true;
						}
						else
						{
							return false;
						}
					}
				}
				else
				{
					return false;
				}
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
}
